<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title></title>

  <!-- Set render engine for 360 browser -->
  <meta name="renderer" content="webkit">

  <!-- No Baidu Siteapp-->
  <meta http-equiv="Cache-Control" content="no-siteapp"/>

  <!-- Add to homescreen for Chrome on Android -->
  <meta name="mobile-web-app-capable" content="yes">

  <!-- Add to homescreen for Safari on iOS -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
  <meta name="msapplication-TileColor" content="#0e90d2">
  <link rel="stylesheet" href="__CDN__/assets/css/amazeui.min.css">
  <link rel="stylesheet" href="__CDN__/assets/css/app.css">
  <style type="text/css">
  	*{
  		margin: 0;
  		padding: 0;
  	}

  	.beijing{
  		background-image: url(__CDN__/images/beijing.png);
  		background-size: 100% 100%;
  	}
  	.content{
  		width: 86%;
  		margin-left: 7%;
      margin-right: 7%;
  		background-size: 100% 100%;
      background-image: url(__CDN__/images/kuang.png);
  	}

    .title{
      border-bottom: 1px solid #C6A452;
      line-height: 54px;
    }
    .title>span{
      font-size: 24px;
    }
    .biaoti{
      font-size: 15px;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp:1;
      overflow: hidden;
      line-height: 65px;
      color:#333333;
    }
    .data{
      color:#333333;
      font-size: 22px;
      margin-left:8px;
    }
    .chakan{
      font-size: 15px;
      line-height: 65px;
      color:#333333;
    }
    .chakan1{
      font-size: 15px;
      color:#333333;
      text-align: center;
    }
    .cont{
      height: 65px;
    }
    .content1{
      height: 65px;
      border-bottom: 1px solid #C6A452;
    }
    .content2{
      height: 150px;
      border-bottom: 1px solid #C6A452;
    }
    .content3{
      line-height: 150px;
    }
    .cont-box{
      border-left: 2px solid #D5AF54;
    }
    .personal{
      line-height: 150px;
    }
    .persoanlHead{
        border-radius:100%;
    }
  </style>
</head>
<body>
<div class="am-g" >
	<div class="am-u-sm-12 beijing am-padding-0" id="bj">
		<div class="am-u-sm-12 am-padding-0 content" id="cot">
      <div class="am-u-sm-12 am-padding-0 am-text-center title">
        {if condition="$success"}
        <span>{$temple.name}</span>
        {else/}<span>暂未绑定寺庙</span>
        {/if}
      </div>
    <div class="am-u-sm-12 am-padding-0 cont-box">


      <div class="am-u-sm-12 am-padding-0 content2">
        <div class="am-u-sm-12 am-padding-right-0 personal">
            <img src="{$user.avatar}" alt="图片加载失败" width="65" height="65" class="persoanlHead">
            <span class="data">{$user.nickname}</span>
        </div>
        <!--<div class="am-u-sm-6 am-padding-0 content3 chakan1" >-->
          <!--微信号：1598742-->
        <!--</div>-->
      </div>
      {if condition="$success"}
      <div class="am-u-sm-12 am-padding-0 content1" style="min-height:80px" >
        <div class="" style="width:100%;height:100%;padding-top:10px;">
          <div class="am-u-sm-6 am-text-center" >
            <button type="button" class="am-btn am-btn-default am-margin-right" id="my-start" style="background:#d3c59d;border:none;outline:none;color:#ffffff;margin:auto">开始日期</button><span id="my-startDate" style="color:#d3c59d;font-size:15px;display: block;margin-top:5px;"></span>
          </div>
          <div class="am-u-sm-6 am-text-center">
            <button type="button" class="am-btn am-btn-default am-margin-right" id="my-end" style="background:#d3c59d;border:none;outline:none;color:#ffffff;margin:auto">结束日期</button><span id="my-endDate" style="color:#d3c59d;font-size:15px;display: block;margin-top:5px;"></span>
          </div>
        </div>
      </div>
      <div class="am-u-sm-12 am-padding-0 content1">
        <div class="am-u-sm-9 am-padding-right-0 cont">
            <span class="biaoti">解签数</span>
        </div>
        <div class="am-u-sm-3 am-padding-0 am-text-center">
          <span class="chakan" id="solve_count">{$temple.today_solve_count}</span>
        </div>
      </div>
      <div class="am-u-sm-12 am-padding-0 content1">
        <div class="am-u-sm-9 am-padding-right-0 cont">
            <span class="biaoti">总解签数</span>
        </div>
        <div class="am-u-sm-3 am-padding-0 am-text-center">
          <span class="chakan">{$temple.solve_count}</span>
        </div>
      </div>
      <div class="am-u-sm-12 am-padding-0 content1">
        <div class="am-u-sm-9 am-padding-right-0 cont">
            <span class="biaoti">扫码数</span>
           
        </div>
        <div class="am-u-sm-3 am-padding-0 am-text-center">
          <span class="chakan" id="qr_count">{$temple.today_qr_count}</span>
        </div>
      </div>
      <div class="am-u-sm-12 am-padding-0 content1">
        <div class="am-u-sm-9 am-padding-right-0 cont">
            <span class="biaoti">总扫码数</span>
            
        </div>
        <div class="am-u-sm-3 am-padding-0 am-text-center">
          <span class="chakan">{$temple.qr_count}</span>
        </div>
      </div>
     {/if}
 
      
    </div> 
		</div>
	</div>
</div>
<script src="__CDN__/assets/js/jquery.min.js"></script>
<script src="__CDN__/assets/js/amazeui.min.js"></script>
<script src="__CDN__/assets/js/amazeui.datetimepicker.min.js"></script>
<script src="__CDN__/layer/layer.js"></script>
<script type="text/javascript">
	var obox = document.getElementById('bj');
  var ocot = document.getElementById('cot');
	var y = document.documentElement.clientHeight;
	obox.style.minHeight = y+'px';
  ocot.style.minHeight = (0.88*y)+'px';
  ocot.style.marginTop = (0.05*y)+'px';
  ocot.style.marginBottom = (0.07*y)+'px';
  var success = '{$success}';
  if(!success){
      layer.confirm('对不起，您还不是管理员！', {
          btn: ['确定'], //按钮
          closeBtn:0,
//                shadeClose:true,
          btnAlign:'c'
      }, function(){
          window.location.href = '__CDN__/Index/index';
      });
  }
    Date.prototype.format = function (format) {
        var args = {
            "M+": this.getMonth() + 1,
            "d+": this.getDate(),
            "h+": this.getHours(),
            "m+": this.getMinutes(),
            "s+": this.getSeconds(),
            "q+": Math.floor((this.getMonth() + 3) / 3),  //quarter
            "S": this.getMilliseconds()
        };
        if (/(y+)/.test(format))
            format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var i in args) {
            var n = args[i];
            if (new RegExp("(" + i + ")").test(format))
                format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? n : ("00" + n).substr(("" + n).length));
        }
        return format;
    };
    var startDate = new Date();
    startDate.setTime(startDate.getTime()-24*60*60*1000);
    var endDate = new Date();
    endDate.setTime(endDate.getTime());
    $('#my-startDate').text(startDate.format('yyyy-MM-dd'));
    $('#my-endDate').text(endDate.format('yyyy-MM-dd'));
    var $alert = $('#my-alert');
    $('#my-start').datepicker().on('changeDate.datepicker.amui', function(event) {
        startDate = new Date(event.date);
        if (event.date.valueOf() >= endDate.valueOf()) {
            endDate = new Date();
            endDate.setTime(startDate.getTime()+24*60*60*1000);
            $('#my-startDate').text(startDate.format('yyyy-MM-dd'));
            $('#my-endDate').text(endDate.format('yyyy-MM-dd'));
//            $alert.find('p').text('开始日期应小于结束日期！').end().show();
        } else {
            $alert.hide();
            $('#my-startDate').text($('#my-start').data('date'));
        }
        getSolveCount(startDate,endDate);
        $(this).datepicker('close');
    });
    $('#my-end').datepicker().on('changeDate.datepicker.amui', function(event) {
        endDate = new Date(event.date);
        if (event.date.valueOf() <= startDate.valueOf()) {
            startDate = new Date();
            startDate.setTime(endDate.getTime()-24*60*60*1000);
            $('#my-startDate').text(startDate.format('yyyy-MM-dd'));
            $('#my-endDate').text(endDate.format('yyyy-MM-dd'));
        } else {
            $alert.hide();
            $('#my-endDate').text($('#my-end').data('date'));
        }
        getSolveCount(startDate,endDate);
        $(this).datepicker('close');
    });

    function getSolveCount(startDate,endDate){
        $.ajax({
            type: "POST",
            url: "__CDN__/index/temple/solve_count",
            async: false,
            data: {
                start_time : startDate,
                end_time : endDate,
                temple_id : "{$temple.id}",
            },
//            dataType: "json",
            success: function (data) {
                $('#qr_count').empty().html(data.qr_count);
                $('#solve_count').empty().html(data.solve_count);
            },
            error: function (data) {
                console.info(data);
            }
        });
    }
</script>
</body>
</html>
